<template>
  <dt-modal-edit ref='tip' title='奖金单名称修改' @ok='onOk' @cancel='onCancel' />
</template>

<script>
  import ruleOpt from '@/biz/option/rule.js'
  import billMgr from '@/biz/bonus/bill'
  export default {
    data() {
      return {
        info: {
          title: null
        },
        change: null,
        id: null
      }
    },
    mounted() {
    },
    methods: {
      show(id, name, change) {
        this.id = id
        this.change = change
        this.info.title = name
        this.$refs.tip.show([{
          title: '奖金单名称',
          key: 'title',
          placeholder: '请输入奖金单名称',
          required: true,
          input: {},
          rules: [
            ruleOpt.required('请输入奖金单名称')
          ]
        }], this.info)
      },
      hide() {
        this.$refs.tip.hide()
      },
      onOk() {
        billMgr.nameEdit(this.id, this.info.title).then(res => {
          this.change(this.info.title)
          this.hide()
        })
      },
      onCancel() {
        this.hide()
      }
    }
  }
</script>

<style>
</style>
